<template>
  
  <el-row :gutter="40" class="panel-group">
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" style="
        border-radius: 25px;;
        background: linear-gradient(to left,  #ffe61f,  #ff9300) !important;
      " @click="handleSetLineChartData('msgdash')">
        <div class="card-panel-icon-wrapper icon-shopping">
          <svg-icon class="el-icon-promotion" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            预警信息总数
          </div>
          <div style="  display: flex;
            justify-content: center;
            align-items: center;;">
          <count-to :start-val="0" :end-val="totalMsgs" :duration="3600" class="card-panel-num" />
          </div>
        </div>
      </div>
    </el-col>
  
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" style="
        border-radius: 25px;" @click="handleSetLineChartData">
        <div class="card-panel-icon-wrapper icon-money">
          <svg-icon class="el-icon-warning" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            预警总次数
          </div>    <div style="  display: flex;
            justify-content: center;
            align-items: center;;">
          <count-to :start-val="0" :end-val="alarmCount" :duration="3200" class="card-panel-num" />
          </div>
        </div>
      </div>
    </el-col>
    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" style="
        border-radius: 25px;" @click="handleSetLineChartData('rank')">
        <div class="card-panel-icon-wrapper ">
          <svg-icon class="el-icon-rank" class-name="card-panel-icon" />
          <!-- <div class="" class-name="card-panel-icon"></div> -->
        </div>
       
        <div class="card-panel-description">
          <div class="card-panel-text">
            污染指数排名
          </div>
          <div style="float: right;">
          <count-to :start-val="0" :end-val="rank" :duration="2600" class="card-panel-num" />
          <span class="el-icon-down" class-name="card-panel-icon" >
          </span>
          <el-tooltip class="item" effect="dark" content="较昨日排名变化" placement="top-start">
            <count-to :start-val="0" :end-val="5" :duration="5000" class="" style="font-size:20px;;" />
          </el-tooltip>
       
        </div>
        </div>
      </div>
    </el-col>

    <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
      <div class="card-panel" style="
        border-radius: 25px;" @click="handleSetLineChartData('online')">
        <div class="card-panel-icon-wrapper icon-message">
          <svg-icon class="el-icon-people" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            在线人数
          </div>
          <div style="  display: flex;
            justify-content: center;
            align-items: center;;">
          <count-to :start-val="0" :end-val="online" :duration="3000" class="card-panel-num" />
        </div>
        </div>
      </div>
    </el-col>

  </el-row>

</template>

<script>
import CountTo from 'vue-count-to'
import { getCityRank} from "@/api/air/pollutant";
import { number } from 'echarts'

export default {
  components: {
    CountTo
  },
  props:["rank","online","totalMsgs","alarmCount"],
  data() {
    return {
      // rank:0,
      // online:0,
    }
  
  },


  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    }
  }
  
}
</script>

<style lang="scss" scoped>
.el-icon-promotion{
  background: url("../hour/pic/信息发布_1.png") center no-repeat;
  background-size: 48px;
}
.el-icon-warning{
  background: url("../hour/pic/预警.png") center no-repeat;
  background-size: 48px;
}
.el-icon-people{
  background: url("../hour/pic/用户.png") center no-repeat;
  background-size: 45px;
}
.el-icon-rank {
    background: url("../hour/pic/排名.png") center no-repeat;;
    background-size: 51px;
}
.el-icon-down {
    background: url("../hour/pic/下降.png") center no-repeat;;
    background-size: 20px;
}
.el-icon-down:before {
    content: "11";
    font-size: 20px;                                   /*可以设置字体大小来确定图标大小*/
        visibility: hidden;  
}
.el-icon-up {
    background: url("../hour/pic/上升.png") center no-repeat;;
    background-size: 25px;
}
.el-icon-up:before {
    content: "11";
    font-size: 20px;                                   /*可以设置字体大小来确定图标大小*/
        visibility: hidden;  
}
 
// .el-icon-sunrise:before {
//     content: "11";
//     font-size: 50px;                                   /*可以设置字体大小来确定图标大小*/
//         visibility: hidden;  
// }

.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

  
    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
  .card-panel:hover {
    box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.24);
    // border: solid 1px black;
}

}

@media (max-width:550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
